<?php
    /**
    -------------------------
    GNU GPL COPYRIGHT NOTICES
    -------------------------
    **
    * $Id$
    *
    * @author thangtt <thangtt@az24.com>
    * @link http://www.az24.vn/
    * @copyright Copyright &copy; 2009-2010 HDC.
    *
    */
    class SendMail {

        public function sendMail($receiver,$message){
            require_once('class.phpmailer.php');
            $name = "Nguyen abc";
            //$message = "danh nhau de";
            $sender = " projectmanager.it43@gmail.com";
            $subject = "subject abc";

            {
                $mail = new PHPMailer();
                $mail->IsSMTP(); // telling the class to use SMTP
                //$mail->Host       = "mail.icoldstyle.com"; // SMTP server
                //$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                // 1 = errors and messages
                // 2 = messages only
                $mail->SMTPAuth   = true;                  // enable SMTP authentication
                //$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
                $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
                $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
                $mail->Username   = " projectmanager.it43@gmail.com";  // GMAIL username
                $mail->Password   = "doantuan";            // GMAIL password

                $mail->SetFrom($sender, $sender);

                $mail->AddReplyTo($sender,$sender);

                $mail->Subject    = "Mail tu he thong Project Manager";

                //$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

                $mail->MsgHTML($message);
                //$mail->Send();        
                //$address = "icoldstyle@gmail.com";
                $address = $receiver;
                $mail->AddAddress($address, "Nguyen Tuan Anh");

                //$mail->AddAttachment("images/phpmailer.gif");      // attachment
                //$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

                if(!$mail->Send()) {
                    echo "Mailer Error: " . $mail->ErrorInfo;
                } else {
                    //echo "Message sent!";
                }
            }

        }
    }

?>
    